
#include "iostream"
#include "vector"
#include "unordered_map"
#include "unordered_set"
#include "algorithm"
#include "string"
#include "list"
#include "string.h"


class OneLoop {
public:
    OneLoop(int a,int b) {
        int zs=a/b;
        a=a%b;
        std::vector<int> xss;
        std::unordered_map<int,char> ys_rec;
//        std::vector<int> ys_rec(10,-1);
        int loop_begin=-1;
        int loop_end=-1;
        ys_rec[a]=xss.size();
        while(a){
            xss.push_back(a*10/b);
            a=a*10%b;
            if(ys_rec.find(a)!=ys_rec.end()
//            [a]!=-1
            ){
                loop_begin=ys_rec[a];
                loop_end=xss.size();
                break;
            }else{
                ys_rec[a]=xss.size();
            }

        }
        int print_cnt=0;
        std::string s= std::to_string(zs);
        std::cout<<s<<'.';
        print_cnt+=s.size();

//        printf("%d.",zs);

        if(loop_begin>=0){
            for(int i=0;i<loop_begin;i++){
                printf("%d",xss[i]);
                print_cnt+=1;
                if(print_cnt%76==0){
                    printf("\n");
                }
            }
            printf("(");
            print_cnt+=s.size()+1;
            for(int i=loop_begin;i<loop_end;i++){
                printf("%d",xss[i]);
                print_cnt+=1;
                if(print_cnt%76==0){
                    printf("\n");
                }
            }
            printf(")");
            print_cnt+=s.size()+1;
        }else{
            if(xss.size()==0){
                printf("0");
            }
            for(auto i:xss){
                printf("%d",i);
                print_cnt+=1;
                if(print_cnt%76==0){
                    printf("\n");
                }
            }
        }
        ;
;
//        };
    }
};

class Solution {
public:
    void run() {

        bool first = true;
        int a,b;
//        std::string s;
        while (std::cin >> a>>b) {
            OneLoop loop(a,b);
        }
    }
};

int main() {
//    bool cur_num= true;
    Solution().run();
    return 0;
}

